function varargout = GUI(varargin)
% GUI MATLAB code for GUI.fig
%      GUI, by itself, creates a new GUI or raises the existing
%      singleton*.
%
%      H = GUI returns the handle to a new GUI or the handle to
%      the existing singleton*.
%
%      GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GUI.M with the given input arguments.
%
%      GUI('Property','Value',...) creates a new GUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before GUI_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to GUI_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help GUI

% Last Modified by GUIDE v2.5 11-Jul-2018 21:08:47

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @GUI_OpeningFcn, ...
                   'gui_OutputFcn',  @GUI_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before GUI is made visible.
function GUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to GUI (see VARARGIN)

% Choose default command line output for GUI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

Data = [];
handles.Data = Data;
disp(Data)
guidata(hObject, handles)
%set(handles.Data)
disp(0)

%Show image of the sensor's positions
myImage = imread('image.png');
set(handles.axes3,'Units','pixels');
resizePos = get(handles.axes3,'Position');
%myImage= imresize(myImage, [resizePos(3) resizePos(3)]);
axes(handles.axes3);
imshow(myImage);
set(handles.axes3,'Units','normalized');

% UIWAIT makes GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = GUI_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in Analyse_mag_pushbutton.
function Analyse_mag_pushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to Analyse_mag_pushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

disp(1)
Data = handles.Data;
disp(2)
Data = GUI_mag(Data);
disp(3)
handles.Data = Data;
guidata(hObject, handles)


% --- Executes on button press in Analyse_gyr_pushbutton.
function Analyse_gyr_pushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to Analyse_gyr_pushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
disp(1)
Data = handles.Data;
disp(2)
Data = GUI_gyr(Data);
disp(3)
handles.Data = Data;
guidata(hObject, handles)




% --- Executes on button press in Analyse_pied_pushbutton.
function Analyse_pied_pushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to Analyse_pied_pushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
disp(1)
Data = handles.Data;
disp(2)
Data = GUI_pied(Data);
disp(3)
handles.Data = Data;

%set(handles.Data);
guidata(hObject, handles)


% --- Executes on button press in Analyse_tout_pushbutton.
function Analyse_tout_pushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to Analyse_tout_pushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in Synchronisation.
function Synchronisation_Callback(hObject, eventdata, handles)
% hObject    handle to Synchronisation (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%get(handles.Data);
disp(1)
Data = handles.Data;
disp(2)
Data = Synchro3(Data);
disp(3)
handles.Data = Data;

%set(handles.Data);
guidata(hObject, handles)   


% --- Executes on button press in Save_pushbutton.
function Save_pushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to Save_pushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
disp(1)
Data = handles.Data;
disp(2)
save('GUI','Data')
disp(3)
handles.Data = Data;

%set(handles.Data);
guidata(hObject, handles)


% --- Executes on button press in Charger_pushbutton.
function Charger_pushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to Charger_pushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Initilalise les données 
Data = [];
handles.Data = Data;
disp(Data)
guidata(hObject, handles)

%charges les données dernièrement sauvegardées
disp(1)
Data = handles.Data;
disp(2)
load('GUI','Data')
disp(3)
handles.Data = Data;

%set(handles.Data);
guidata(hObject, handles)
